package com.elink.enginerring.news.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.elink.enginerring.news.dao.NewsTagMapper;
import com.elink.enginerring.news.entity.NewsTag;

@Service
public class NewsTagService  implements INewsTagService{
	@Autowired
	private NewsTagMapper newsTagService;

	@Override
	public void addBatch(String tagIds,String newsId) {

		List<NewsTag> list = new ArrayList<NewsTag>();
		for (String tagId : tagIds.split(",")) {
			NewsTag tag = new NewsTag();
			tag.setNewsId(newsId);
			tag.setTagId(Integer.parseInt(tagId));
             list.add(tag);

		}
		newsTagService.insertBatch(list);
	}

}
